package selenium.page;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.Select;

/**
 * @Author quan
 * @Description 下拉框处理
 * @Date 2023/8/17 16:10
 */
public class Demo3_Select {
    public static void main(String[] args) {
        Page03();
    }

    private static void Page03() {
        //1、打开浏览器驱动
        WebDriver webDriver = new ChromeDriver();
        //2、打开网页
        webDriver.get("http://localhost:63342/TestClass/src/main/Page/test03.html?_ijt=5vi46n1ldrqlkan442l34uil5o&_ij_reload=RELOAD_ON_SAVE");
        //3、选择
        Select select = new Select(webDriver.findElement(By.cssSelector("#ShippingMethod")));
//        select.selectByValue("12.51");
        select.selectByIndex(2);// 10.69
        select.selectByIndex(1);// 10.69
    }
}
